home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-11-19 | 39.7 KB | 1,279 lines |
- // Fireworks GoLive 4 and Cyberstudio 3.1 HTML & JavaScript for sliced output.
- // Version 3.0 09SEP99
-
- // To export HTML without comments change the value of variable doComments to "false".
- var doComments=true;
- var indentNestedImagemaps=false;
-
-
-
- // When doComments is set to "true" the WRITE_HTML_COMMENT and WRITE_JS_COMMENT functions
- // include HTML and JavaScript comments in the exported file.
- function WRITE_HTML_COMMENT(str) {
- if (doComments) WRITE_HTML("<!--"+str+"-->\n");
- }
-
- function WRITE_JS_COMMENT(str) {
- if (doComments) WRITE_HTML("/* "+str+" */\n");
- }
-
- function Fix(href)
- {
- // change C|/ to C:/ jba
- var re = /\|\//i;
-
- href = href.toString().replace(re, ":/");
- return(href);
- }
-
- var doHeader = true;
- doHeader = exportDoc.generateHeader;
- // When HTML is generated to a file, generateHeader is true.
- // When HTML is generated for the clipboard,
- // generateHeader is false.
-
- // These are the suffixes for the first 4 frames
- var sfx = new Array();
- sfx[0] = ""; // first frame doesn't normally have a suffix.
- sfx[1] = "_f2"; // second frame.
- sfx[2] = "_f3"; // third frame.
- sfx[3] = "_f4"; // fourth frame.
- var numSFX = 4;
- function UpdateFileNames(curSlices) {
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- if (curSlices[curRow][curCol].skipCell) continue;
- var nestedTable = curSlices[curRow][curCol].nestedTableSlices;
- if (nestedTable) {
- UpdateFileNames(nestedTable);
- continue;
- }
- var curSlice = curSlices[curRow][curCol];
- var cellName = "";
- if (curSlice && curSlice.getFrameFileName(0)) {
- cellName = curSlice.getFrameFileName(0).toString();
- var i;
- var limit = exportDoc.numFrames;
- if (limit > numSFX) limit = numSFX;
- for (i=0; i<limit; i++) {
- if (curSlice.getFrameFileName(i)) {
- curSlice.setFrameFileName(i, cellName + sfx[i]);
- }
- }
- }
- }
- }
- }
- UpdateFileNames(slices);
-
- var d = new Date();
- if (doHeader) {
- WRITE_HTML("<html>\n");
- WRITE_HTML("\n");
- WRITE_HTML(" <head>\n");
-
- WRITE_HTML("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
- var charSet = "";
- if (App) charSet = App.getPref("HtmlCharSet");
- if (charSet == "") charSet = "iso-8859-1";
- WRITE_HTML(charSet + "\">\n");
- WRITE_HTML("<meta name=\"description\" content=\"Fireworks Splice HTML\">\n");
-
- // Use Base Name from export dialog as document title.
- WRITE_HTML("<title>", exportDoc.filename, "</title>\n");
- WRITE_HTML("<csscriptdict>\n");
- WRITE_HTML(" <script><!--\n");
- WRITE_HTML("\n");
- }
- WRITE_HTML("<!-- Fireworks 3.0 GoLive 4/Cyberstudio 3.1 target. Created ", d, " -->\n");
- WRITE_HTML("\n");
-
- var curIdCounter = d.getTime() & 0x7FFFF000;
-
- // Function cellName determines the name for the image in a particular table cel
- // cellName is based off of the slice name if one was specified. Otherwise the
- // Base file name from the export dialog is used.
- function CellName(curSlices, row, col) {
- var curSlice = curSlices[row][col];
- var cellName = "";
- if (curSlice && curSlice.getFrameFileName(0)) {
- cellName = curSlice.getFrameFileName(0).toString();
- curSlice.setFrameFileName(0, cellName);
- // remove illegal characters
- cellName = cellName.replace(/\W/g, "");
- // if it starts with a number, add N to the front.
- if (cellName == "") cellName = "n" + exportDoc.imagename + "_" + (row+1) + "_" + (col+1);
- if (cellName.search(/\d/) == 0) {
- cellName = "n"+cellName;
- }
- }
- if (cellName!="") return(cellName);
-
- var prefix;
- if (!curSlices) return("nullCellName");
- if (curSlices.id == 0) {
- prefix = "";
- } else {
- prefix = curSlices.id+"_";
- }
- var suffix="";
- if (curSlices.numRows > 1 || curSlices.numColumns > 1) {
- suffix = "_" + (row+1) + "_" + (col+1);
- }
- cellName = "n" + prefix + exportDoc.imagename + suffix;
- return(cellName);
- }
-
-
-
- // Declare variables for processing Behaviors.
- var kActionStatusMessage = 1;
- var kActionSwapImage = 2;
- var kActionButtonDown = 4;
- var kActionSwapImageRestore = 5;
- var kActionButtonHighlight = 6;
- var kActionButtonRestore = 7;
-
-
- var kEventMouseOver = 0;
- var kEventOnClick = 1;
- var kEventMouseOut = 2;
- var kEventOnLoad = 3;
-
-
- var hasAnyButtons = false;
- var needsPreloads = false;
-
- function IsSwap(curBeh) {
- if (curBeh.action == kActionButtonHighlight ||
- curBeh.action == kActionSwapImage ||
- curBeh.action == kActionButtonDown) {
- return(true);
- }
- return(false);
- }
-
- function DoRestore(curBeh) {
- if (curBeh.action == kActionButtonHighlight) return(true);
- return(curBeh.restoreOnMouseout);
- }
-
- function DoFile(curBeh) {
- var swapRow = curBeh.targetRowNum;
- var swapCol = curBeh.targetColumnNum;
- var swapFrame = curBeh.targetFrameNum;
- var swapTable = curBeh.targetTable;
- if (!swapTable) return;
-
- var fileName = swapTable[swapRow][swapCol].getFrameFileName(0);
- if (curBeh.downHighlight && curBeh.hasDhTargetFrame) {
- var fm = curBeh.dhTargetFrameNum;
- if (!swapTable[swapRow][swapCol].getFrameFileName(fm)) {
- var tmp;
- var frame = fm+1;
- if (fm < 4) {
- tmp = fileName + sfx[fm];
- } else {
- tmp = fileName + "_f" + frame;
- }
- swapTable[swapRow][swapCol].setFrameFileName(fm, tmp);
- }
- }
- if (curBeh.hasTargetFrame && swapFrame > 0) {
- if (!swapTable[swapRow][swapCol].getFrameFileName(swapFrame)) {
- var frame = swapFrame + 1;
- if (swapFrame < 4) {
- fileName = fileName + sfx[swapFrame];
- } else {
- fileName = fileName + "_f" + frame;
- }
- swapTable[swapRow][swapCol].setFrameFileName(swapFrame, fileName);
- }
- }
- if (curBeh.preload) {
- DoPreload(curBeh);
- }
- }
-
- function DoPreload(curBeh) {
- }
-
- function CheckFileAndPreloads(curSlices) {
-
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- var curSlice = curSlices[curRow][curCol];
- if (curSlice.skipCell) continue;
- var nestedTable = curSlices[curRow][curCol].nestedTableSlices;
- if (nestedTable) {
- CheckFileAndPreloads(nestedTable);
- continue;
- }
- if (curSlice.behaviors.numberOfBehaviors > 0) {
- var behaviors = curSlices[curRow][curCol].behaviors;
- for (var i=0; i<behaviors.numberOfBehaviors; i++) {
- var curBehavior = behaviors[i];
- curBehavior.id = curIdCounter;
- curIdCounter+=2; // restore behavior is this + 1.
- DoFile(curBehavior);
- if (IsSwap(curBehavior)) {
- if (curBehavior.hasTargetFrame && curBehavior.targetFrameNum==1 && curBehavior.event == kEventMouseOver) {
- //alert(" "+curRow+","+curCol+", tgt "+curBehavior.targetRowNum+","+curBehavior.targetColumnNum);
- if (curRow == curBehavior.targetRowNum && curCol == curBehavior.targetColumnNum && curSlices==curBehavior.targetTable) {
- curSlices[curRow][curCol].isButton = true;
- }
- }
- }
- }
- }
- var imagemap = curSlice.imagemap;
-
- for (var j=0; j < imagemap.numberOfURLs; j++) {
- curSlice.isButton = false; // imagemaps aren't buttons. jba.
- var curImagemap = imagemap[j];
- var behaviors = curImagemap.behaviors;
- curImagemap.modBehaviors = behaviors; // Need to save a copy for obscure reasons. jba.
- for (var i=0; i<behaviors.numberOfBehaviors; i++) {
- var curBehavior = behaviors[i];
- DoFile(curBehavior);
- curBehavior.id = curIdCounter;
- curIdCounter+=2; // restore behavior is this + 1.
- if (IsSwap(curBehavior)) {
- DoFile(curBehavior);
- }
- }
- }
- if (curSlice.isButton) {
- hasAnyButtons = true;
- }
- }
- }
-
- }
-
- CheckFileAndPreloads(slices);
-
- var csAct = "";
- var csactionsStr = "";
- var csactionItem = ""
-
- var dirPath = Fix(slices.imagesDirPath);
-
-
- function DoFileAndPreloads(curSlices) {
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- var curSlice = curSlices[curRow][curCol];
- if (curSlice.skipCell) continue;
- var nestedTable = curSlices[curRow][curCol].nestedTableSlices;
- if (nestedTable) {
- DoFileAndPreloads(nestedTable);
- continue;
- }
- curSlice.overAction = "";
- curSlice.outAction = "";
- curSlice.clickAction = "";
- curSlice.csover = "";
- curSlice.csout = "";
- curSlice.csclick = "";
- if (!curSlice.isButton) continue;
- var cellName = CellName(curSlices, curRow,curCol);
- var button = new Object;
- button.name = cellName;
- var upFrame = 0;
- if (slices.doDemoHTML && slices.demoIndex>0 &&
- slices.demoIndex == curSlice.downIndex) {
- upFrame = 2;
- }
-
- button.up = "'"+dirPath + curSlice.getFrameFileName(upFrame) + curSlice.imageSuffix + "'";
- button.over = "''";
- button.hit = "''";
- button.status = "";
- if (curSlice.hasAltText) {
- button.status = curSlice.altText;
- }
- var behaviors =curSlice.behaviors;
- for (var i=0; i<behaviors.numberOfBehaviors; i++) {
- var curBehavior = behaviors[i];
- if (curBehavior.action == kActionStatusMessage) {
- var hexName = curBehavior.id.toString(16);
- if (curBehavior.event == kEventMouseOver) {
- button.status = curBehavior.statusText;
- curBehavior.ateTheBehavior = true;
- } else {
- // CSAct['B2C231A71'] = new Array(CSSetStatus,' ');
- /* Generate a csact entry */
- var curAction = "CSAct['" + hexName + "'] = new Array(CSSetStatus,";
- curAction += "'" + curBehavior.statusText + "');\n";
- csAct += curAction;
- // <csaction name="B2C231A71" class="Set Status" val0=" ">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Set Status\" val0=\"" ;
- curAction += curBehavior.statusText + "\">\n"
- csactionsStr += curAction;
- if (curBehavior.event == kEventOnClick) {
- if (curSlice.csclick != "") curSlice.csclick += ",";
- curSlice.csclick += hexName;
- if (curSlice.clickAction != "") curSlice.clickAction += ",";
- curSlice.clickAction += "'"+hexName+"'";
- }
- if (curBehavior.event == kEventMouseOut) {
- if (curSlice.csout != "") curSlice.csout += ",";
- curSlice.csout += hexName;
- if (curSlice.outAction != "") curSlice.outAction += ",";
- curSlice.outAction += "'"+hexName+"'";
- }
- }
- }
-
- if (IsSwap(curBehavior)) {
- var swapRow = curBehavior.targetRowNum;
- var swapCol = curBehavior.targetColumnNum;
- var swapTable = curBehavior.targetTable;
- if (swapRow == curRow && swapCol == curCol && swapTable == curSlices) {
- if (curBehavior.hasHref) {
- fileName = curBehavior.href;
- } else {
- fileName = dirPath + curSlice.getFrameFileName(curBehavior.targetFrameNum) + curSlice.imageSuffix;
- }
- if (curBehavior.event == kEventMouseOver) {
- button.over = "'"+fileName+"'";
- curBehavior.ateTheBehavior = true;
- }
- if (curBehavior.event == kEventOnClick) {
- button.hit = "'"+fileName+"'";
- curBehavior.ateTheBehavior = true;
- }
- if (curBehavior.event == kEventMouseOut) {
- curBehavior.ateTheBehavior = true;
- }
- }
- if (!curBehavior.ateTheBehavior) {
- curRestore = DoRestore(curBehavior);
- var swapRow = curBehavior.targetRowNum;
- var swapCol = curBehavior.targetColumnNum;
- var swapFrame = curBehavior.targetFrameNum;
- var swapTable = curBehavior.targetTable;
- var fileName;
- if (curBehavior.hasHref) {
- fileName = curBehavior.href;
- } else {
- fileName = dirPath + swapTable[swapRow][swapCol].getFrameFileName(swapFrame) + swapTable[swapRow][swapCol].imageSuffix;
- }
- var hexName = curBehavior.id.toString(16);
- var cellName = CellName(swapTable, swapRow,swapCol);
- //CSAct['B2DB1B0B1'] = new Array(CSSetImageURL,'RalphTheImage_mtv',/*URL*/ 'mtv_F3.gif');
- /* Generate a csact entry */
- var curAction = "CSAct['" + hexName + "'] = new Array(CSSetImageURL,";
- // target name
- curAction += "'" + cellName + "',/*URL*/ '" + fileName + "');\n";
- csAct += curAction;
- // <csaction name="B2DB1B0B1" class="Set Image URL" val0="RalphTheImage_mtv" val1="mtv_F3.gif">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Set Image URL\" val0=\"" ;
- curAction += cellName+"\" val1=\"" + fileName + "\">\n"
- csactionsStr += curAction;
- if (curBehavior.event == kEventMouseOver) {
- if (curSlice.csover != "") curSlice.csover += ",";
- curSlice.csover += hexName;
- if (curSlice.overAction != "") curSlice.overAction += ",";
- curSlice.overAction += "'"+hexName+"'";
- }
- if (curBehavior.event == kEventOnClick) {
- if (curSlice.csclick != "") curSlice.csclick += ",";
- curSlice.csclick += hexName;
- if (curSlice.clickAction != "") curSlice.clickAction += ",";
- curSlice.clickAction += "'"+hexName+"'";
- }
- if (curBehavior.event == kEventMouseOut) {
- if (curSlice.csout != "") curSlice.csout += ",";
- curSlice.csout += hexName;
- if (curSlice.outAction != "") curSlice.outAction += ",";
- curSlice.outAction += "'"+hexName+"'";
- } else if (curRestore) {
- hexName = (curBehavior.id+1).toString(16);
- fileName = dirPath + swapTable[swapRow][swapCol].getFrameFileName(0) + swapTable[swapRow][swapCol].imageSuffix;
- /* Generate a csact entry */
- var curAction = "CSAct['" + hexName + "'] = new Array(CSSetImageURL,";
- // target name
- curAction += "'" + cellName + "',/*URL*/ '" + fileName + "');\n";
- csAct += curAction;
- // <csaction name="B2DB1B0B1" class="Set Image URL" val0="RalphTheImage_mtv" val1="mtv_F3.gif">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Set Image URL\" val0=\"" ;
- curAction += cellName+"\" val1=\"" + fileName + "\">\n"
- csactionsStr += curAction;
- if (curSlice.csout != "") curSlice.csout += ",";
- curSlice.csout += hexName;
- if (curSlice.outAction != "") curSlice.outAction += ",";
- curSlice.outAction += "'"+hexName+"'";
- }
-
- }
- }
- }
-
- if (curSlice.isButton) {
- curSlice.buttonStatus = button.status;
- if (doHeader) {
- WRITE_HTML("CSILoad('" +button.name +"',new Array(");
- WRITE_HTML("/*URL*/"+button.up+",/*URL*/"+button.over+",/*URL*/"+button.hit+",'"+button.status+"'));\n");
- }
-
- }
- }
-
- }
-
- }
-
- function WritePreloads(curSlices) {
- /* Write preloads */
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- if (curSlices[curRow][curCol].skipCell) continue;
- var nestedTable = curSlices[curRow][curCol].nestedTableSlices;
- if (nestedTable) {
- WritePreloads(nestedTable);
- continue;
- }
- for (var curFrame = 0; curFrame < exportDoc.numFrames; curFrame++) {
- if (curSlices[curRow][curCol].isButton && curFrame < 4 && curFrame != 2) {
- // Buttons preload their first 3 states.
- continue;
- }
- var curFile = curSlices[curRow][curCol].getFrameFileName(curFrame);
- if (!curFile) continue;
- if (curFrame == 0 && !curSlices[curRow][curCol].isSwapped) continue;
- needsPreloads = true; // just in case.
- var hexName = curIdCounter.toString(16);
- curIdCounter += 2;
- // CSAction(new Array('B31EB2911'));
- WRITE_HTML("CSAction(new Array('" + hexName + "'));\n");
-
- // CSAct['B31EB2911'] = new Array(CSPreloadImage,/*URL*/ 'ESPN_F2.gif');
- fileName = dirPath + curFile + curSlices[curRow][curCol].imageSuffix;
- var curAction = "CSAct['" + hexName + "'] = new Array(CSPreloadImage,/*URL*/ '";
- curAction += fileName + "');\n"
- csAct += curAction;
-
- // <csaction name="B31EB2911" class="Preload Image" val0="ESPN_F2.gif">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Preload Image\" val0=\"" ;
- curAction += fileName + "\">\n"
- csactionsStr += curAction;
-
- //<csactionitem name="B31EB2911"></csactionitem>
- csactionItem += " <csactionitem name=\"" + hexName + "\"></csactionitem>\n";
-
- }
- }
- }
-
- }
-
- if (hasAnyButtons || needsPreloads) {
- if (doHeader) {
- WRITE_HTML("function CSScriptInit() {\n");
- }
- DoFileAndPreloads(slices);
- if (doHeader) {
- WritePreloads(slices);
- WRITE_HTML("}\n");
- }
- }
-
- function DoBehavior(curSlices, curBehavior, parentObject) {
- if (curBehavior.action == kActionStatusMessage) {
- if (!curBehavior.id) {
- alert(curBehavior + ", "+parentObject);
- }
- var hexName = curBehavior.id.toString(16);
- curRestore = DoRestore(curBehavior);
- // CSAct['B2C231A71'] = new Array(CSSetStatus,' ');
- /* Generate a csact entry */
- var curAction = "CSAct['" + hexName + "'] = new Array(CSSetStatus,";
- curAction += "'" + curBehavior.statusText + "');\n";
- csAct += curAction;
- // <csaction name="B2C231A71" class="Set Status" val0=" ">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Set Status\" val0=\"" ;
- curAction += curBehavior.statusText + "\">\n"
- csactionsStr += curAction;
- if (curBehavior.event == kEventOnClick) {
- if (parentObject.csclick != "") parentObject.csclick += ",";
- parentObject.csclick += hexName;
- if (parentObject.clickAction != "") parentObject.clickAction += ",";
- parentObject.clickAction += "'"+hexName+"'";
- }
- if (curBehavior.event == kEventMouseOver) {
- if (parentObject.csover != "") parentObject.csover += ",";
- parentObject.csover += hexName;
- if (parentObject.overAction != "") parentObject.overAction += ",";
- parentObject.overAction += "'"+hexName+"'";
- }
- if (curBehavior.event == kEventMouseOut) {
- if (parentObject.csout != "") parentObject.csout += ",";
- parentObject.csout += hexName;
- if (parentObject.outAction != "") parentObject.outAction += ",";
- parentObject.outAction += "'"+hexName+"'";
- } else if (curRestore) {
- hexName = (curBehavior.id+1).toString(16);
- var curAction = "CSAct['" + hexName + "'] = new Array(CSSetStatus,";
- curAction += "' ');\n";
- csAct += curAction;
- // <csaction name="B2C231A71" class="Set Status" val0=" ">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Set Status\" val0=\" \">\n"
- csactionsStr += curAction;
- if (parentObject.csout != "") parentObject.csout += ",";
- parentObject.csout += hexName;
- if (parentObject.outAction != "") parentObject.outAction += ",";
- parentObject.outAction += "'"+hexName+"'";
- }
- }
- if (IsSwap(curBehavior)) {
- var swapRow = curBehavior.targetRowNum;
- var swapCol = curBehavior.targetColumnNum;
- var swapTable = curBehavior.targetTable;
-
- var curRestore = DoRestore(curBehavior);
- var swapFrame = curBehavior.targetFrameNum;
- var fileName;
- if (curBehavior.hasHref) {
- fileName = curBehavior.href;
- } else {
- fileName = dirPath + swapTable[swapRow][swapCol].getFrameFileName(swapFrame) + swapTable[swapRow][swapCol].imageSuffix;
- }
- var hexName = curBehavior.id.toString(16);
- var cellName = CellName(swapTable, swapRow,swapCol);
- //CSAct['B2DB1B0B1'] = new Array(CSSetImageURL,'RalphTheImage_mtv',/*URL*/ 'mtv_F3.gif');
- /* Generate a csact entry */
- var curAction = "CSAct['" + hexName + "'] = new Array(CSSetImageURL,";
- // target name
- curAction += "'" + cellName + "',/*URL*/ '" + fileName + "');\n";
- csAct += curAction;
- // <csaction name="B2DB1B0B1" class="Set Image URL" val0="RalphTheImage_mtv" val1="mtv_F3.gif">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Set Image URL\" val0=\"" ;
- curAction += cellName+"\" val1=\"" + fileName + "\">\n"
- csactionsStr += curAction;
- if (curBehavior.event == kEventMouseOver) {
- if (parentObject.csover != "") parentObject.csover += ",";
- parentObject.csover += hexName;
- if (parentObject.overAction != "") parentObject.overAction += ",";
- parentObject.overAction += "'"+hexName+"'";
- }
- if (curBehavior.event == kEventOnClick) {
- if (parentObject.csclick != "") parentObject.csclick += ",";
- parentObject.csclick += hexName;
- if (parentObject.clickAction != "") parentObject.clickAction += ",";
- parentObject.clickAction += "'"+hexName+"'";
- }
- if (curBehavior.event == kEventMouseOut) {
- if (parentObject.csout != "") parentObject.csout += ",";
- parentObject.csout += hexName;
- if (parentObject.outAction != "") parentObject.outAction += ",";
- parentObject.outAction += "'"+hexName+"'";
- } else if (curRestore) {
- hexName = (curBehavior.id+1).toString(16);
- fileName = dirPath + swapTable[swapRow][swapCol].getFrameFileName(0) + swapTable[swapRow][swapCol].imageSuffix;
- /* Generate a csact entry */
- var curAction = "CSAct['" + hexName + "'] = new Array(CSSetImageURL,";
- // target name
- curAction += "'" + cellName + "',/*URL*/ '" + fileName + "');\n";
- csAct += curAction;
- // <csaction name="B2DB1B0B1" class="Set Image URL" val0="RalphTheImage_mtv" val1="mtv_F3.gif">
- curAction = " <csaction name=\"" + hexName + "\" class=\"Set Image URL\" val0=\"" ;
- curAction += cellName+"\" val1=\"" + fileName + "\">\n"
- csactionsStr += curAction;
- if (parentObject.csout != "") parentObject.csout += ",";
- parentObject.csout += hexName;
- if (parentObject.outAction != "") parentObject.outAction += ",";
- parentObject.outAction += "'"+hexName+"'";
- }
-
- }
- }
-
-
- function DoSlicesThatAreNotButtons(curSlices) {
- // Handle not button and imagemap actions.
- for (var curRow = 0; curRow < curSlices.numRows; curRow++) {
- for (var curCol = 0; curCol < curSlices.numColumns; curCol++) {
- var curSlice = curSlices[curRow][curCol];
- if (curSlice.skipCell) continue;
- var nestedTable = curSlices[curRow][curCol].nestedTableSlices;
- if (nestedTable) {
- DoSlicesThatAreNotButtons(nestedTable);
- continue;
- }
-
- if (curSlice.isButton) continue;
- curSlice.overAction = "";
- curSlice.outAction = "";
- curSlice.clickAction = "";
- curSlice.csover = "";
- curSlice.csout = "";
- curSlice.csclick = "";
- var cellName = CellName(curSlices, curRow,curCol);
- var behaviors =curSlice.behaviors;
- for (var i=0; i<behaviors.numberOfBehaviors; i++) {
- var curBehavior = behaviors[i];
- DoBehavior(curSlices, curBehavior, curSlice);
- }
- curSlice.hasJavascript = curSlice.overAction != "" || curSlice.outAction != "" || curSlice.clickAction != "";
- var imagemap = curSlice.imagemap;
- for (var j=0; j < imagemap.numberOfURLs; j++) {
- var curImagemap = imagemap[j];
- curImagemap.overAction = "";
- curImagemap.outAction = "";
- curImagemap.clickAction = "";
- curImagemap.csover = "";
- curImagemap.csout = "";
- curImagemap.csclick = "";
- var modBehaviors = curImagemap.modBehaviors;
- for (var i=0; i<modBehaviors.numberOfBehaviors; i++) {
- var curBehavior = modBehaviors[i];
- DoBehavior(curSlices, curBehavior, curImagemap);
- }
- }
- }
- }
- }
-
- DoSlicesThatAreNotButtons(slices);
-
- var Name = 0;
- WRITE_HTML("\n");
- if (doHeader) {
- WRITE_HTML("CSAg = window.navigator.userAgent;" + "CSBVers = parseInt" + "(CSAg.charAt" + "(CSAg.indexOf");
- WRITE_HTML("(");
- WRITE_HTML("\"");
- WRITE_HTML("/");
- WRITE_HTML("\")+1),10);\n");
- }
-
- function IsIE(){ return CSAg.indexOf("MSIE") > 0;}
- function CSIEStyl(s) { return document.all.tags("div")[s].style; }
- function CSNSStyl(s){ return CSFindElement(s,0); }
- function CSFindElement(n,ly) {
- if (CSBVers < 4) return document[n];
- var curDoc = ly ? ly.document : document; var elem = curDoc[n];
- if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
- elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
- return elem;
- }
- function CSButtonReturn () {
- var bAgent = window.navigator.userAgent;
- var bAppName = window.navigator.appName;
- if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
- return false; // follow link
- else return true; // follow link
- }
- function CSClickReturn () {
- var bAgent = window.navigator.userAgent;
- var bAppName = window.navigator.appName;
- if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
- return false; // follow link
- else return true; // follow link
- }
- function CSIShow(n,i) {
- if (document.images) {
- if (CSIm[n]) {
- var img = (!IsIE()) ? CSFindElement(n,0) : document[n];
- if (img) {img.src = CSIm[n][i].src; self.status = CSIm[n][3];}
- return true;
- }
- }
- return false;
- }
- function CSILoad(im,ar) {
- if (document.images) {
- CSIm[im] = new Object();
- for (var i=0;i<3;i++) {
- if (ar[i] != '') { CSIm[im][i] = new Image(); CSIm[im][i].src = ar[i]; }
- else CSIm[im][i] = 0;
- }
- CSIm[im][3] = ar[3];
- }
- }
- function CSAction(array) {
- var result;
- for (var i=0;i<array.length;i++) {
- result = CSAct[array[i]][0](CSAct[array[i]]);
- }
- return result;
- }
- function CSSetImageURL(action) {
- var img = null;
- if (document.images) {
- if (!IsIE()) img = CSFindElement(action[1],0);
- else img = document.images[action[1]];
- if (img) img.src = action[2];
- }
- }
- function CSSetStatus(action) { self.status = action[1]; }
-
- if (doHeader) {
-
- WRITE_HTML(IsIE);
- WRITE_HTML(CSIEStyl);
- WRITE_HTML(CSNSStyl);
- WRITE_HTML(CSFindElement);
- WRITE_HTML(CSButtonReturn);
- WRITE_HTML(CSClickReturn);
- WRITE_HTML("CSIm = new Object();\n");
- WRITE_HTML(CSIShow);
- WRITE_HTML(CSILoad);
- WRITE_HTML(CSAction);
- if (csAct != "") {
- WRITE_HTML("CSAct = new Object;\n");
- }
-
- WRITE_HTML(CSSetImageURL);
- WRITE_HTML(CSSetStatus);
-
- if (needsPreloads) {
- WRITE_HTML("CSImages=new Array();\n");
- function CSPreloadImage(action) {
- if (document.images) { CSImages[CSImages.length]=new Image(); CSImages[CSImages.length-1].src=action[1]; }
- }
- WRITE_HTML(CSPreloadImage);
- }
-
- if (csAct != "") {
- WRITE_HTML(csAct);
- }
-
- WRITE_HTML("// --></script>\n</csscriptdict>\n");
- if (csactionsStr != "") {
- WRITE_HTML("<csactions>\n");
- WRITE_HTML(csactionsStr);
- WRITE_HTML("</csactions>\n");
- }
-
- WRITE_HTML(csactionItem);
-
- WRITE_HTML("</head>\n\n");
- }
-
- //$JS
-
-
- function DoImagemap(curSlice) {
- if (curSlice.skipCell)
- return;
- if (curSlice.hasImagemap) {
- if (curSlice.isButton) {
- alert("Slice "+curRow+","+curCol+" is a button! With Imagemap! OOPS!");
- }
- // Write the image map.
- var imageName = curSlice.getFrameFileName(0);
- WRITE_HTML("<map name=\"m_", imageName, "\">");
-
- var i = 0;
- while (i < curSlice.imagemap.numberOfURLs) {
- var curImagemap = curSlice.imagemap[i];
-
- // Write the area tag with shape definitions.
- WRITE_HTML("<area shape=\"");
- WRITE_HTML(curImagemap.shape); // Shapes are rect poly and circle
- WRITE_HTML("\" coords=\"");
- for (var j=0; j<curImagemap.numCoords; j++) {
- if (j>0) WRITE_HTML(",");
- // polygon has n coords.
- // rect has 2 coords, topLeft, and botomRight.
- // Circle has one coord, center; plus radius.
- WRITE_HTML((curImagemap.xCoord(j)-curSlice.left), ",", (curImagemap.yCoord(j)-curSlice.top));
- }
- if (curImagemap.shape == "circle") {
- // Write the radius for circle hotspots.
- WRITE_HTML(", ", curImagemap.radius);
- }
- WRITE_HTML("\"");
- var href = " href=\"#\"";
- if (curImagemap.hasHref) {
- href = " href=\"";
- href += curImagemap.href;
- href += "\"";
- if (curImagemap.hasTargetText) {
- href += " target=\"";
- href += curImagemap.targetText;
- href += "\"";
- }
- }
-
- WRITE_HTML(href);
-
- // Write alt text for hotspot.
- var altText = "";
- if (curImagemap.hasAltText) {
- altText = curImagemap.altText;
- } else {
- altText = exportDoc.altText;
- }
-
- if (altText!="") {
- WRITE_HTML(" title=\"", altText, "\"");
- WRITE_HTML(" alt=\"", altText, "\"");
- }
-
- if (curImagemap.overAction) {
- WRITE_HTML(" onmouseover=\"");
- WRITE_HTML("CSAction(new Array(" + curImagemap.overAction + "));");
- WRITE_HTML("return true;");
- WRITE_HTML("\"");
- WRITE_HTML(" csover=\"" + curImagemap.csover + "\"");
- }
-
- if (curImagemap.outAction) {
- WRITE_HTML(" onmouseout=\"");
- WRITE_HTML("CSAction(new Array(" + curImagemap.outAction + "));");
- WRITE_HTML("return true;");
- WRITE_HTML("\"");
- WRITE_HTML(" csout=\"" + curImagemap.csout + "\"");
- }
-
- if (curImagemap.clickAction) {
- WRITE_HTML(" onclick=\"");
- WRITE_HTML("CSAction(new Array(" + curImagemap.clickAction + "));");
- WRITE_HTML("return CSClickReturn();");
- WRITE_HTML("\"");
- WRITE_HTML(" csclick=\"" + curImagemap.csclick + "\"");
- }
-
- WRITE_HTML(">");
- i++;
- }
- gotJavascript = curSlice.overAction || curSlice.outAction || curSlice.clickAction;
- // If the current slice had a URL attached, it was moved and written here.
- var link = "";
- if (curSlice.hasHref) {
- link = curSlice.href;
- } else {
- if (exportDoc.backgroundLink) {
- link = exportDoc.backgroundLink.href;
- }
- }
-
- // If the current slice had a URL attached, it was moved and written here.
- if (gotJavascript || link != "") {
- WRITE_HTML("<area shape=\"rect\" coords=\"0,0, ", curSlice.width, ",", curSlice.height, "\" ");
- var href="#";
- if (link && link!="") {
- href = link;
- }
- WRITE_HTML("href=\"", href, "\"");
- if (curSlice.hasTargetText) {
- WRITE_HTML("\n target=\"", curSlice.targetText, "\"");
- }
- if (curSlice.overAction) {
- WRITE_HTML(" onmouseover=\"");
- WRITE_HTML("CSAction(new Array(" + curSlice.overAction + "));");
- WRITE_HTML("return true;");
- WRITE_HTML("\"");
- WRITE_HTML(" csover=\"" + curSlice.csover + "\"");
- }
-
- if (curSlice.outAction) {
- WRITE_HTML(" onmouseout=\"");
- WRITE_HTML("CSAction(new Array(" + curSlice.outAction + "));");
- WRITE_HTML("return true;");
- WRITE_HTML("\"");
- WRITE_HTML(" csout=\"" + curSlice.csout + "\"");
- }
-
- if (curSlice.clickAction) {
- WRITE_HTML(" onclick=\"");
- WRITE_HTML("CSAction(new Array(" + curSlice.clickAction + "));");
- WRITE_HTML("return CSClickReturn();");
- WRITE_HTML("\"");
- WRITE_HTML(" csclick=\"" + curSlice.csclick + "\"");
- }
-
- var altText = "";
- if (curSlice.hasAltText) {
- altText = curSlice.altText;
- } else {
- altText = exportDoc.altText;
- }
- if (altText!="") {
- WRITE_HTML(" title=\"", altText, "\"");
- WRITE_HTML(" alt=\"", altText, "\"");
- }
- WRITE_HTML(">");
- }
- WRITE_HTML("</map>");
- //WRITE_HTML("\n");
- }
- }
-
-
- if (doHeader) {
-
- WRITE_HTML("<body bgcolor=\"#", exportDoc.backgroundColor.toString(), "\"");
- if (hasAnyButtons) {
- WRITE_HTML(" onload=\"CSScriptInit();\"");
- }
- WRITE_HTML(">\n");
-
- WRITE_HTML("\n");
- }
-
-
- function WriteTable(curSlices, indent) {
- var needTable = curSlices.numRows > 1 || curSlices.numColumns > 1;
- var curCol;
- var curRow;
- var downIndex = 0;
- if (needTable) {
- WRITE_HTML("<table ");
-
- // If the Fireworks document's canvas is not transparent and the Include undefined curSlices checkbox
- // is off, give the table a background color based on the FIreworks document's canvas color.
- if (!exportDoc.backgroundIsTransparent && curSlices.doSkipUndefined) {
- WRITE_HTML("bgcolor=\"#", exportDoc.backgroundColor, "\"");
- }
-
- WRITE_HTML("border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"",
- curSlices.width, "\">\n");
-
- /* This is the magic comment for html update. */
- if (indent == "") {
- //<--- fwtable fwsrc="mydoc" fwbase="basename" --->
- var comment = "<!-- fwtable fwsrc=\"" + exportDoc.docSaveName + "\" fwbase=\"" + exportDoc.filename + "\"" + " -->\n";
- WRITE_HTML(comment);
- }
-
-
- if (curSlices.doShimEdges) {
- WRITE_HTML(" <tr>");
- for (curCol = 0; curCol < curSlices.numColumns; curCol++) {
- WRITE_HTML(" <td><img src=\"", curSlices.shimPath, "\" width=\"",
- curSlices[0][curCol].cellWidth, "\" height=\"1\" border=\"0\"></td>\n");
- }
- WRITE_HTML(" <td><img src=\"", curSlices.shimPath, "\" width=\"1",
- "\" height=\"1\" border=\"0\"></td>\n");
- WRITE_HTML(" </tr>\n");
- }
- }
-
- for (curRow = 0; curRow < curSlices.numRows; curRow++) {
-
- if (needTable) {
- WRITE_HTML(indent+" <tr valign=\"top\">");
- WRITE_HTML_COMMENT(" row "+(curRow+1)+" ");
- }
-
- for (curCol = 0; curCol < curSlices.numColumns; curCol++) {
-
- var curSlice = curSlices[curRow][curCol];
- if (curSlice.skipCell) continue;
-
-
- // Write rowspan and colspan if necessary. Ex: rowspan="1" colspan="3"
- if (needTable) {
- // Write rowspan and colspan if necessary. Ex: rowspan="1" colspan="3"
- WRITE_HTML(indent+" <td");
- if (curSlice.rowSpan > 1) {
- WRITE_HTML(" rowspan=\"", curSlice.rowSpan,"\"");
- }
- if (curSlice.columnSpan>1) {
- WRITE_HTML(" colspan=\"", curSlice.columnSpan, "\"");
- }
- WRITE_HTML(">");
- }
-
- var suffix = "";
- var cellName = exportDoc.imagename + "_" + (curRow+1) + "_" + (curCol+1);
-
- var nestedTable = curSlice.nestedTableSlices;
- if (nestedTable) {
- WriteTable(nestedTable, " "+indent);
- if (needTable) {
- WRITE_HTML("</td>");
- }
- WRITE_HTML("\n");
- continue;
- }
-
- // Write HTML text from curSlices set to "Text (No Image)"
- if (!curSlice.hasImage) {
- // no image, just dump out html text.
- if (curSlice.htmlText) {
- WRITE_HTML(curSlice.htmlText);
- } else if (needTable) {
- if (curSlices.shimPath) {
- WRITE_HTML("<img src=\"",
- curSlices.shimPath, "\" width=\"", curSlice.width, "\" height=\"",
- curSlice.height, "\" border=\"0\">");
- }
- }
- if (needTable) WRITE_HTML("</td>\n");
- continue;
- }
-
- // If current slice is not defined by a slice object and Export Undefined
- // curSlices is not checked, don't output an image and if Shims are specified
- // place a shim image in the current cel
- if (curSlice.isUndefined && curSlices.doSkipUndefined) {
- if (needTable) {
- if (curSlices.shimPath) {
- WRITE_HTML("<img src=\"",
- curSlices.shimPath, "\" width=\"", curSlice.width, "\" height=\"",
- curSlice.height, "\" border=\"0\">");
- }
- WRITE_HTML("</td>\n");
- }
- // Tell Fireworks to not write the image file. Setting the filename to "" forces
- // Fireworks to not generate the image.
- var q;
- for (q=0; q<exportDoc.numFrames; q++) {
- curSlice.setFrameFileName(q, "");
- }
- continue;
- }
-
- var cellName = CellName(curSlices, curRow, curCol);
- var button = new Object;
- button.name = cellName;
- var upFrame = 0;
- if (slices.doDemoHTML && slices.demoIndex>0 &&
- slices.demoIndex == curSlice.downIndex) {
- upFrame = 2;
- }
-
- button.up = dirPath + curSlice.getFrameFileName(upFrame) + curSlice.imageSuffix
- button.over = "";
- button.hit = "";
-
- var behaviors = curSlice.behaviors;
- for (var i=0; i<behaviors.numberOfBehaviors; i++) {
- var curBehavior = behaviors[i];
- if (IsSwap(curBehavior)) {
- var swapRow = curBehavior.targetRowNum;
- var swapCol = curBehavior.targetColumnNum;
- var swapTable = curBehavior.targetTable;
- if (swapRow != curRow || swapCol != curCol || swapTable != curSlices) continue;
- if (!curBehavior.ateTheBehavior) continue;
- if (curBehavior.hasHref) {
- fileName = curBehavior.href;
- } else {
- fileName = dirPath + curSlice.getFrameFileName(curBehavior.targetFrameNum) + curSlice.imageSuffix;
- }
- if (curBehavior.event == kEventMouseOver) {
- button.over = fileName;
- }
- if (curBehavior.event == kEventOnClick) {
- button.hit = fileName;
- }
-
- }
- }
- var isButton = curSlice.isButton;
-
- if (!isButton && (curSlice.hasImagemap || !curSlice.hasJavascript) ){
- var imageName = curSlice.getFrameFileName(0);
- if (slices.doDemoHTML && slices.demoIndex>0 &&
- slices.demoIndex == curSlice.downIndex) {
- imageName = curSlice.getFrameFileName(2);
- }
- var altText = "";
- if (curSlice.hasAltText) {
- altText = curSlice.altText;
- } else {
- altText = exportDoc.altText;
- }
- // <img name="n_03_02" src="File_03_02.gif" width="79" height="71" border="0"
- WRITE_HTML("<img name=\"", cellName, "\" src=\"",
- dirPath, imageName, curSlice.imageSuffix, "\" width=\"",
- curSlice.width,"\" height=\"", curSlice.height, "\" border=\"0\"");
- if (altText != "") {
- WRITE_HTML(" alt=\"", altText, "\"");
- }
- if (curSlice.hasImagemap) {
- WRITE_HTML(" usemap=\"#m_",imageName,"\"");
- }
- WRITE_HTML(">");
- if (curSlice.hasImagemap) DoImagemap(curSlice);
- if (needTable) WRITE_HTML("</td>\n");
- continue;
- }
-
- if (isButton) {
- WRITE_HTML(" <csobj w=\"");
- WRITE_HTML(curSlice.width);
- WRITE_HTML("\" ");
- WRITE_HTML("h=\"");
- WRITE_HTML(curSlice.height);
- WRITE_HTML("\"");
- WRITE_HTML(" t=\"Button\" ");
- if (button.over != "") {
- WRITE_HTML(" ht=\"");
- WRITE_HTML(button.over);
- WRITE_HTML("\"");
- }
- if (button.hit != "") {
- WRITE_HTML(" cl=\"");
- WRITE_HTML(button.hit);
- WRITE_HTML("\"");
- }
-
- if (curSlice.csover != "") {
- WRITE_HTML(" csover=\"" + curSlice.csover + "\"");
- }
- if (curSlice.csclick != "") {
- WRITE_HTML(" csclick=\"" + curSlice.csclick + "\"");
- }
- if (curSlice.csout != "") {
- WRITE_HTML(" csout=\"" + curSlice.csout + "\"");
- }
- WRITE_HTML(">");
- }
-
- // Write link if slice has URL attached.
- var href = "href=\"#\"";
- var hasHref = curSlice.hasHref;
- if (curSlice.hasHref) {
- href = "href=\"";
- href += curSlice.href;
- href += "\"";
- if (curSlice.hasTargetText) {
- href += " target=\"";
- href += curSlice.targetText;
- href += "\"";
- }
-
- } else {
- var link = "";
- if (exportDoc.backgroundLink) {
- link = exportDoc.backgroundLink.href;
- }
- if (link != "") {
- hasHref = true;
- href = "href=\"" + link +"\"";
- }
- }
-
- if (slices.doDemoHTML && curSlice.downIndex>0) {
- href = "href=\"" + slices.demoHref(curSlice.downIndex) +".htm\"";
- }
- WRITE_HTML("<a " + href);
- WRITE_HTML("\"");
-
- var mouseOver = curSlice.overAction || isButton;
- if (mouseOver) {
- WRITE_HTML(" onmouseover=\"");
- if (curSlice.overAction) {
- WRITE_HTML("CSAction(new Array(" + curSlice.overAction + "));");
- }
- if (isButton) {
- WRITE_HTML("return CSIShow(");
- WRITE_HTML("'");
- WRITE_HTML(button.name);
- WRITE_HTML("',1)");
- } else {
- WRITE_HTML("return true;");
- }
- WRITE_HTML("\" ");
- }
-
- var mouseOut = curSlice.outAction || isButton;
- if (mouseOut) {
- WRITE_HTML(" onmouseout=\"");
- if (curSlice.outAction) {
- WRITE_HTML("CSAction(new Array(" + curSlice.outAction + "));");
- }
- if (isButton) {
- WRITE_HTML("return CSIShow(");
- WRITE_HTML("'");
- WRITE_HTML(button.name);
- WRITE_HTML("',0)");
- } else {
- WRITE_HTML("return true;");
- }
- WRITE_HTML("\" ");
- }
-
- var clickButton = isButton && button.hit != "";
- var click = curSlice.clickAction || clickButton;
- if (click) {
-
- WRITE_HTML("onclick=\"");
- if (curSlice.clickAction) {
- WRITE_HTML("CSAction(new Array(" + curSlice.clickAction + "));");
- }
- if (clickButton) {
- WRITE_HTML("CSIShow('");
- WRITE_HTML(button.name);
- WRITE_HTML("',2)");
- WRITE_HTML(";return CSButtonReturn()");
- } else {
- WRITE_HTML("return(true);");
- }
- WRITE_HTML("\"");
- }
- if (!isButton) {
- if (curSlice.csover != "") {
- WRITE_HTML(" csover=\"" + curSlice.csover + "\"");
- }
- if (curSlice.csclick != "") {
- WRITE_HTML(" csclick=\"" + curSlice.csclick + "\"");
- }
- if (curSlice.csout != "") {
- WRITE_HTML(" csout=\"" + curSlice.csout + "\"");
- }
- }
- WRITE_HTML(">");
-
- var imageName = curSlice.getFrameFileName(0);
- if (slices.doDemoHTML && slices.demoIndex>0 &&
- slices.demoIndex == curSlice.downIndex) {
- imageName = curSlice.getFrameFileName(2);
- }
- var altText = curSlice.buttonStatus;
-
- // <img name="n_03_02" src="File_03_02.gif" width="79" height="71" border="0"
- WRITE_HTML("<img name=\"", cellName, "\" src=\"",
- dirPath, imageName, curSlice.imageSuffix, "\" width=\"",
- curSlice.width,"\" height=\"", curSlice.height, "\" border=\"0\"");
- if (curSlice.hasImagemap) {
- // usemap="#$NM" ismap
- WRITE_HTML(" usemap=\"#m_", imageName, "\"");
- }
- if (altText != "") {
- WRITE_HTML(" alt=\"", altText, "\"");
- }
-
- WRITE_HTML(">");
-
-
- WRITE_HTML("</a>");
- if (isButton) WRITE_HTML("</csobj>");
- if (needTable) WRITE_HTML("</td>\n");
- }
-
- if (needTable) {
- if (curSlices.doShimEdges) {
- /* Write the 1 pixel transparent shim. */
- WRITE_HTML(" <td><img src=\"",
- curSlices.shimPath, "\" width=\"1\" height=\"",
- curSlices[curRow][0].cellHeight, "\" border=\"0\"></td>\n");
- }
- WRITE_HTML(indent+" </tr>\n");
- }
- }
- if (needTable) {
- // Close table.
- WRITE_HTML(indent+"</table>");
- }
- }
-
- WriteTable(slices, "");
-
- WRITE_HTML("\n");
- WRITE_HTML("<!-- This HTML was automatically created with Macromedia Fireworks 3.0 http://www.macromedia.com -->\n");
- WRITE_HTML("\n");
- if (doHeader) {
- WRITE_HTML("</body>\n");
- WRITE_HTML("</html>\n");
- }
-
-
-
-